var vm = new Vue({
	el: '#app',
	data: {
		search: {
			phone: '',
			userId: null
		}
	},
	methods: {
		/**
		 * 重置搜索栏
		 * @returns
		 */
		reset: function() {
			vm.search.userId = null;
		},
		initTable() {
			// 表格数据请求地址
			var ajaxUrl = baseURL + 'wallet/accounts';
			// 配置表头
			var arr = [{
					"data": "userId"
			    },
				{
					"data": "phone"
				},
				{
					"data": "taskAmount"
				},
				{
					"data": "incomeAmount"
				},
				{
					"data": "withdrawAmount"
				},
				{
					"data": "assureAmount"
				},
				{
					"data": "refreshNum"
				},
				{
					"data": "status",
					"render": function(data, type, row) {
						return data == 1 ?'正常':'冻结';
					}
				}
			];
			// 初始化表格
			TABLE.init(ajaxUrl, arr);
		},
		/**
		 * 打开用户搜索框
		 */
		openUserSearch: function() {

			layer.open({
				type: 2,
				area: ['900px', '480px'],
				fixed: false, //不固定
				maxmin: true,
				btn: ['确定', '取消'],
				title: "选择用户",
				content: baseURL + 'search/user-search.html',
				yes: function(index, layero) {
					var data = getIframeTableData(layero);
					if (data == null) {
						layer.msg('请选择至少一条记录！');
					} else {
						vm.search.phone = data.phone;
						vm.search.userId = parseInt(data.id);
						layer.close(index);
					}
				}
			});
		}
	},
	mounted() {
		this.initTable();
	}
})

